#include <iostream>
#include <vector>
using namespace std;

int const maxn = 610;
vector<vector<int> > graph;
int linked[maxn];
bool visited[maxn];
int n, k;

void add_edge(int u, int v)
{
	graph[u].push_back(v);
}

typedef vector<int>::iterator iter_edge;
bool hungarian_dfs(int u)
{
	for (iter_edge it = graph[u].begin(); it != graph[u].end(); ++it) {
		int v = *it;
		if (!visited[v]) {
			visited[v] = true;
			if (linked[v] == -1 || hungarian_dfs(linked[v])) {
				linked[u] = v;
				linked[v] = u;
				return true;
			}
		}
	}
	return false;
}

void print_plan()
{
	vector<vector<int> > ans_plan;
	ans_plan.resize(k);
	for (int i = 0; i < n; i++) {
		if (linked[i] == -1) continue;
		int t = linked[i] - n;
		if (t >= k) t-= k;
		ans_plan[t].push_back(i+1);
	}
	for (int i = 0; i < k; i++) {
		cout << ans_plan[i].size();
		for (vector<int>::iterator it = ans_plan[i].begin();
				it != ans_plan[i].end(); it++)
			cout << " " << *it;
		cout << endl;
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> n >> k;
	int node_num = n + 2*k;
	graph.resize(node_num);
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		for (int j = 0, tmp; j < t; j++) {
			cin >> tmp;
			add_edge(i, n + tmp-1);
			add_edge(i, n + k + tmp-1);
		}
	}

	int bi_match = 0;
	fill(linked, linked + node_num, -1);
	for (int i = 0; i < n; i++) {
		fill(visited, visited + node_num, false);
		if (hungarian_dfs(i)) bi_match++;
	}

	if (bi_match == 2*k) {
		cout << "YES" << endl;
		print_plan();

	} else
		cout << "NO" << endl;
}

